﻿using InventoryIssue.API.Write.Application.Command.Allocate;
using InventoryIssue.API.Write.Application.Command.Reportloss;
using InventoryIssue.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace InventoryIssue.API.Write.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ReportlossController : ControllerBase
    {
        private readonly IMediator mediator;

        public ReportlossController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 新增报损单信息接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> CreateReportloss(CreateReportlossCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        ///  删除报损单信息接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<int>> DelReportloss(DelReportlossCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
